<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('预警列表')" />
    <th:block th:include="include :: ztree-css" />
    <style type="text/css">
        .content li a {color:blue;}
        .content li a:hover {color:black;}
    </style>
</head>
<body class="gray-bg">
    <!-- 按钮触发模态框 -->
    <!--<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">整改建议</button>-->
    <!-- 模态框（Modal） -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">整改建议</h4>
                </div>
                <div class="modal-body">
                    <textarea id="auditSuggest" rows="4" style="width:100%" placeholder="请输入整改建议..."></textarea>
                    <div th:style="'display:block'">
                        <label class="control-label">风险点：</label>
                        <div style="height: 120px;overflow-x: scroll" >
                            <div id="paeaErPoint" class="ztree control-label" th:required="required"></div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" onclick="riskAddBatchSubmit()">提交</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
     <div class="container-div">
        <div class="row">
            <div class="col-xs-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li class="select-time">
                                <p>交易日期：</p>
                                <input type="text" class="time-input" id="startTrDate" placeholder="必填" name="startTrDate" required/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTrDate" name="endTrDate"/>
                            </li>
                            <li>
                                <p>机构号：</p>
                                <input name="brCode" style="width: 70%" onclick="selectDeptTree()"  id="treeId" type="text" placeholder="请选择" class="form-control">
                            </li>
                            <li>
                                <p>状态：</p>
                                <select id="status" name="status" style="width: 50%;" th:with="type=${@dict.getType('paea_risk_item_status')}">
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                    <option value="">所有</option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="tableSerch()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                            <li>
                                <p>预警类型：</p>
                                <select id="impType" name="impType" style="width: 30%;">
                                    <option th:each="paeaAuType:${paeaAuTypes}" th:value="${paeaAuType.code}" th:text="${paeaAuType.code+'-'+paeaAuType.name}" th:selected="${paeaAuType.code==impType}"></option>
                                </select>
                                <span style="color: black;margin-left:15px;">预警总数【<span style="color: red" id="totalNum">0</span>】</span>
                                <span style="color: grey;">未监控【<span style="color: red" id="noRiskNum" >0</span>】</span>
                                <span style="color: blue;margin-left: 13px;">正常【<span style="color: red" id="normalNum" >0</span>】</span>
                                <span style="color: red">督办【<span style="color: red" id="errorNum">0</span>】</span>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="btn-group-sm" id="toolbar" role="group">
                <div class="btn-group content">
                    <button type="button" class="btn btn-primary" data-toggle="dropdown">预警小助手</button>
                    <button type="button" class="btn btn-primary dropdown-toggle"
                            data-toggle="dropdown">
                        <span class="caret"></span>
                        <span class="sr-only">切换下拉菜单</span>
                    </button>
                    <ul class="dropdown-menu" role="menu">
                        <li><a href="#" onclick="commonSearch('交易流水查询',ctx+'paea/paeaDsTrade')">交易流水查询</a></li>
                        <li><a href="#" onclick="commonSearch('账号/卡号查询',ctx+'query/paeaDsLink')">账号/卡号查询</a></li>
                        <li><a href="#" onclick="commonSearch('交易码查询',ctx+'para/paeaParaTxnCde')">交易码查询</a></li>
                        <li><a href="#" onclick="writeLog();">监控日志</a></li>
                        <li><a href="#" onclick="commonSearch('网点基本情况查询',ctx+'para/authorizer')">网点基本情况查询</a></li>
                        <li><a href="#" onclick="commonSearch('汇率查询',ctx+'para/smActXrt')">汇率查询</a></li>
                        <li><a href="#" onclick="commonSearch('对公客户信息',ctx+'query/paeaDsCusvd4')">对公客户信息</a></li>
                        <li><a href="#" onclick="_querySignature()">有权人签字</a></li>
                    </ul>
                </div>
               <a class="btn btn-info" onclick="exportItem()" shiro:hasPermission="oms:paeaRiskItem:exportItem">
                    <i class="fa fa-download"></i> 导出预警
               </a>&nbsp;
                <a id="riskInfo1" class="btn btn-success" onclick="checkAll()">
                    <i class="fa"></i> 全选
                </a>&nbsp;
                <a id="riskInfo2"  class="btn btn-success" onclick="uncheckAll()">
                    <i class="fa"></i> 取消全选
                </a>&nbsp;
               <a id="riskInfo3" class="btn btn-success" onclick="doConfirmBatch()" shiro:hasPermission="oms:paeaRiskItem:doConfirmBatch">
                    <i class="fa"></i> 批量提交
                </a>&nbsp;
                <a id="riskInfo4" class="btn btn-success" onclick="showRiskAdd(null)" shiro:hasPermission="oms:paeaRiskItem:export">
                    <i class="fa"></i> 创建差错
                </a>&nbsp;
                <a id="riskInfo5"  class="btn btn-success" onclick="riskAddBatch()" shiro:hasPermission="oms:paeaRiskItem:export">
                    <i class="fa"></i> 批量创建差错
                </a>&nbsp;
            </div>
            <div class="col-xs-12 select-table table-striped table-hover">
                <table th:title="展开本行显示预警详情" id="bootstrap-table"></table>
            </div>
        </div>
    </div>

     <th:block th:include="include :: footer" />
    <th:block th:include="include :: ztree-js" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('oms:paeaRiskItem:edit')}]];
        var removeFlag = [[${@permission.hasPermi('oms:paeaRiskItem:remove')}]];
        var paeaRiskItemStatus = [[${@dict.getType('paea_risk_item_status')}]];
        var prefix = ctx + "oms/paeaRiskItem";
        //初始化预警量
        function initRiskNum(){
            var paeaRiskItemNumModels = [[${paeaRiskItemNumModels}]];
            var totalNum = 0;
            $.each(paeaRiskItemNumModels, function (i, v) {
                if (v.status == 1) {
                    $("#noRiskNum").text(v.countNum);
                }else if(v.status == 2){
                    $("#normalNum").text(v.countNum);
                }else if(v.status == 3){
                    $("#errorNum").text(v.countNum);
                }
            });
            totalNum = parseInt($("#noRiskNum").text())+parseInt($("#normalNum").text())+parseInt($("#errorNum").text())
            $("#totalNum").text(totalNum);
        }
        $(document).ready(function(){
            initRiskNum();
        });
        function setRiskNum(){
            var data = $('#formId').serialize();
            $.operate.post(prefix + "/getPaeaRiskItemNumModel",data,function (action) {
                var riskNumModels = JSON.parse(action.msg);
                var totalNum = 0;
                $("#totalNum").text("0");
                $("#noRiskNum").text("0");
                $("#normalNum").text("0");
                $("#errorNum").text("0");
                $.each(riskNumModels, function (i, v) {
                    if (v.status == 1) {
                        $("#noRiskNum").text(v.countNum);
                    }else if(v.status == 2){
                        $("#normalNum").text(v.countNum);
                    }else if(v.status == 3){
                        $("#errorNum").text(v.countNum);
                    }
                });
                totalNum = parseInt($("#noRiskNum").text())+parseInt($("#normalNum").text())+parseInt($("#errorNum").text())
                $("#totalNum").text(totalNum);
            });
        }
        //选择机构
        function selectDeptTree() {
            var treeId = $("#treeId").val();
            var deptId = $.common.isEmpty(treeId) ? "00038" : $("#treeId").val();
            var url = ctx + "system/dept/selectDeptTree/" + deptId;
            var options = {
                title: '选择部门',
                width: "380",
                url: url,
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }
        function doSubmit(index, layero){
            var tree = layero.find("iframe")[0].contentWindow.$._tree;
            if ($.tree.notAllowParents(tree)) {
                var body = layer.getChildFrame('body', index);
                $("#treeId").val(body.find('#treeId').val());
                layer.close(index);
            }
        }
        function tableSerch() {
            if(!$.validate.form()){
                return;
            }
            var impType = $('#impType option:selected').val();
            var data = {impType: impType};
            $.operate.post(prefix + "/getAuditFifldInfo", data, function (result) {
                if (result.code == web_status.SUCCESS) {
                    var rt = result.msg;
                    var auditFildInfos = JSON.parse(rt);
                    //表头数组拼接
                    var columns = [{
                        checkbox: true,
                        title:'选择',
                        formatter: function (value, row, index) {
                        if(row.status&&row.status=='3'){
                            return {disabled : true};
                        }
                    }
                    }, {
                        field: 'id',
                        title: 'id',
                        visible: false
                    }];
                    var status = false;
                    $.each(auditFildInfos, function (i, v) {
                        if(v.entityCode=='status'){
                            columns.push({
                                field: v.entityCode,
                                title: v.name,
                                align: 'center',
                                formatter: function(value, row, index) {
                                    return $.table.selectDictLabel(paeaRiskItemStatus, value);
                                }
                            });
                            status = true;
                        }else{
                            columns.push({
                                field: v.entityCode,
                                title: v.name,
                                align: 'center'
                            });
                        }
                    });
                    if(!status){
                        columns.push({
                            field: 'status',
                            title: '状态',
                            align: 'center',
                            formatter: function(value, row, index) {
                                return $.table.selectDictLabel(paeaRiskItemStatus, value);
                            }
                        });
                    }
                    columns.push({
                        field : 'operateRow',
                        title: '操作',
                        align: 'center',
                        formatter: function (value, row, index) {
                            var actions = [];
                            if(row.vchNo&&row.vchNo!=null&&row.vchNo!=''){//查看流水详情
                                actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="_viewTradeDetail(\'' + row.vchNo + '\',\'' + row.trDate + '\',\'' + row.brCode + '\',\'' + row.trTelr + '\')"><i class="fa"></i>流水详情</a> ');
                            }
                            if(row.status&&row.status=='3'){//已下发风险
                                actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="viewErrDetail(\'' + row.errId + '\')"><i class="fa"></i>查看预警单</a> ');
                            }else if(row.status&&row.status=='2'){//确认正常
                                actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" ><i class="fa"></i>'+row.auOper+'-'+'确认正常</a> ');
                            }else if(row.status&&row.status=='1'){//未监督
                                actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="doConfirm(\'' + row.id + '\',\'' + row.status + '\')"><i class="fa"></i>提交</a>');
                            }
                            if(row.status&&row.status!='3'){//未下发风险
                                actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="showRiskAdd(\'' + row.id + '\')"><i class="fa"></i>创建差错</a> ');
                            }
                            return actions.join('');
                        }
                    });
                    var itemoptions = {
                        id:"bootstrap-table",
                        url: prefix + "/queryRisk",
                        createUrl: prefix + "/add",
                        updateUrl: prefix + "/edit/{id}",
                        removeUrl: prefix + "/remove",
                        exportUrl: prefix + "/export",
                        showExport: true,
                        modalName: "预警信息",
                        detailView: true,
                        onExpandRow : initChildTable,
                        showPageGo: true,
                        columns: columns
                    };
                    $.table.destroy();
                    $.table.init(itemoptions);
                    //更新预警量
                    setRiskNum();
                } else if (result.code == web_status.WARNING) {
                    $.modal.alertWarning(result.msg)
                } else {
                    $.modal.alertError(result.msg);
                }
                $.modal.closeLoading();
            });
        }
        //子表视图
        function initChildTable(index, row, $detail) {
            var childTable = $detail.html('<table style="table-layout:fixed"></table>').find('table');
            //获取表头
            var data = {impType: row.impType};
            $.operate.post(prefix + "/getAuditDetailFifldInfo", data, function (result) {
                if (result.code == web_status.SUCCESS) {
                    var rt = result.msg;
                    var auditFildInfos = JSON.parse(rt);
                    //表头数组拼接
                    var columns = [{
                        radio: true
                    }, {
                        field: 'id',
                        title: 'id',
                        visible: false
                    }];
                    $.each(auditFildInfos, function (i, v) {
                        columns.push({
                            field: v.entityCode,
                            title: v.name,
                            align: 'center'
                        });
                    });
                    columns.push({
                        title: '操作',
                        align: 'center',
                        formatter: function(value, row, index) {
                            var actions = [];
                            if(row.vchNo&&row.vchNo!=null&&row.vchNo!=''){//查看流水详情
                                actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="_viewTradeDetail(\'' + row.vchNo + '\',\'' + row.trDate + '\',\'' + row.brCode + '\',\'' + row.trTelr + '\')"><i class="fa"></i>流水详情</a> ');
                            }
                            return actions.join('');
                        }
                    });
                    var detailoptions = {
                        url: ctx + "oms/paeaRiskItem/queryPaeaRiskItemDetail",
                        modalName: "预警详情",
                        method: 'post',
                        sidePagination: "server",
                        contentType: "application/x-www-form-urlencoded",
                        queryParams : {
                            relId: row.relId,dataDate:row.dataDate,impType:row.impType
                        },
                        rowStyle:detailRowStyle,//通过自定义函数设置行样式
                        columns: columns
                    };
                    $(childTable).bootstrapTable(detailoptions);
                } else if (result.code == web_status.WARNING) {
                    $.modal.alertWarning(result.msg)
                } else {
                    $.modal.alertError(result.msg);
                }
                $.modal.closeLoading();
            });
        };
        //表格样式
        function detailRowStyle(row, index) {
            var style = {};
            style={css:{'color':'#0f2ded'}};
            return style;
        }
        /*function showRiskDetail(field,value,row){
            if(field!='operateRow'){
                alert("点击+查看预警详情");
            }
        }*/
        function checkAll(){
            $('#bootstrap-table').bootstrapTable('checkAll');
        }
        function uncheckAll(){
            $('#bootstrap-table').bootstrapTable('uncheckAll');//uncheckAll全部取消 checkInvert反选
        }
        //单笔下发差错
        function showRiskAdd(_riskId)
        {
            var riskId = _riskId;
            if(riskId==null){
                var ids = $.table.selectColumns("id");
                if(ids.length<1 || ids.length>1){
                    alert("请选择一条数据");
                    return;
                }else{
                    ids = ids.join();
                }
                riskId = ids;
            }
            var data = {riskId:riskId};
            $.operate.post(prefix + "/getRegisteErrInfo", data, function (result) {
                if (result.code == web_status.SUCCESS) {
                    var errinfo = result.msg;
                    var infoArray = $.common.split(errinfo,"@");
                    registerErrorPre(infoArray[0],infoArray[1],infoArray[2],infoArray[3],infoArray[4],infoArray[5],infoArray[6],infoArray[7],infoArray[8],infoArray[9]);
                } else if (result.code == web_status.WARNING){
                    $.modal.alertWarning(result.msg);
                } else {
                    $.modal.alertError(result.msg);
                }
                $.modal.closeLoading();
            });
        }
        //调用创建差错模
        var operateType = "";
        function registerErrorPre(errSource,vchFlag,manFlag,trDate,orgId,tellerId,vchNo,tradeId,auTypeId,auditItemId){
            var url =  ctx  + 'er/paeaErErrorRegister/registerErrorPre?errSource='+errSource+'&vchFlag='+vchFlag+'&manFlag='+manFlag+'&trDate='+trDate+'&orgId='+orgId+'&tellerId='+tellerId+'&vchNo='+vchNo+'&tradeId='+tradeId+'&auTypeId='+auTypeId+'&auditItemId='+auditItemId;
            operateType = "cancel";
            modal_open("创建督办", url,"","","",function(){
                //更新预警信息
                if(operateType=='submit'){
                    upItemById(auditItemId);
                }
            });
        }
        //更新预警信息
        function upItemById(id){
            var data = {itemId:id};
            $.operate.post(ctx + "oms/paeaRiskItem/registerErrorUpItem", data, function (result) {
                if (result.code == web_status.SUCCESS){
                    var statusmsg = result.msg;
                    var status = statusmsg.substring(0,1);
                    var msg = statusmsg.substring(1);
                    $.modal.alertSuccess(msg);
                    if(status&&status=='1'){//更新预警量
                        $("#noRiskNum").text(parseInt($("#noRiskNum").text())-1);
                        $("#errorNum").text(parseInt($("#errorNum").text())+1);
                    }else if(status&&status=='2'){
                        $("#normalNum").text(parseInt($("#normalNum").text())-1);
                        $("#errorNum").text(parseInt($("#errorNum").text())+1);
                    }
                }else if (result.code == web_status.WARNING){
                    $.modal.alertWarning(result.msg);
                }else {
                    $.modal.alertError(result.msg);
                }
                $.modal.closeLoading();
                $.table.refresh();
            });
        }
        function riskAddBatch()
        {
            $('#auditSuggest').text("");
            var auTypeId="";
            var impTypes = $.table.selectColumns("impType");
            if(impTypes==''){
                auTypeId = $('#impType option:selected').val();
            }else{
                auTypeId = impTypes[0];
            }
            var errSource=[[${errorSource}]];
            var url = ctx+"er/paeaErPoint/pointTreeData/"+auTypeId+"/"+errSource;
            var options = {
                id: "paeaErPoint",
                url: url,
                check: { enable: true, nocheckInherit: true, chkboxType: { "Y": "ps", "N": "ps" } },
                expandLevel: 2
            };
            $.tree.init(options);
            $('#myModal').modal('show');
        }
        function riskAddBatchSubmit()
        {
            var url = prefix+"/addRiskBatch";
            var ids = $.table.selectColumns("id");
            var auditSuggest = $('#auditSuggest').text();
            var paeaErPoints = $.tree.getCheckedNodes();
            if(auditSuggest==''||auditSuggest.length<1){
                alert("请输入整改建议");
                return;
            }
            if(paeaErPoints==null||paeaErPoints==null||paeaErPoints.length<1){
                alert("请选择风险点");
                return;
            }
            if(ids==''){
                if(confirm("没有做出选择，将下发该查询条件下所有未处理的预警数据，是否确定下发？")){
                    $('#myModal').modal('hide');
                    var paeaRiskItemQuery = $("#formId").serialize();
                    var data = $.extend(data,{auditSuggest:auditSuggest,paeaErPoints:paeaErPoints});
                    $.operate.post(url,data,function (result) {
                        if (result.code == web_status.SUCCESS) {
                            $.modal.alertSuccess(result.msg);
                        }else if (result.code == web_status.WARNING) {
                            $.modal.alertWarning(result.msg)
                        } else {
                            $.modal.alertError(result.msg);
                        }
                        $.modal.closeLoading();
                        $.table.refresh();
                        //更新预警量
                        setRiskNum();
                    });
                }
            }else{
                $('#myModal').modal('hide');
                ids = ids.join();
                var data = {ids:ids,auditSuggest:auditSuggest,paeaErPoints:paeaErPoints};
                $.operate.post(url,data,function (result) {
                    if (result.code == web_status.SUCCESS) {
                        $.modal.alertSuccess(result.msg);
                    }else if (result.code == web_status.WARNING) {
                        $.modal.alertWarning(result.msg)
                    } else {
                        $.modal.alertError(result.msg);
                    }
                    $.modal.closeLoading();
                    $.table.refresh();
                    //更新预警量
                    setRiskNum();
                });
            }
        }
        function doConfirm(id,status){
            var url = prefix+"/doConfirm";
            var data = {id:id};
            $.operate.post(url,data,function (result) {
                if (result.code == web_status.SUCCESS) {
                    $.modal.alertSuccess(result.msg);
                    if(status&&status==1){//更新预警量
                        $("#noRiskNum").text(parseInt($("#noRiskNum").text())-1);
                        $("#normalNum").text(parseInt($("#normalNum").text())+1);
                    }
                }else if (result.code == web_status.WARNING) {
                    $.modal.alertWarning(result.msg)
                } else {
                    $.modal.alertError(result.msg);
                }
                $.modal.closeLoading();
                $.table.refresh();
            });
        }
        function doConfirmBatch(){
            var url = prefix+"/doConfirmBatch";
            var ids = $.table.selectColumns("id");
            if(ids==''){
                if(confirm("没有做出选择，将提交该查询条件下所有未处理的预警数据，是否确定提交？")){
                    var data = $("#formId").serialize();
                    $.operate.post(url,data,function (result) {
                        if (result.code == web_status.SUCCESS) {
                            $.modal.alertSuccess(result.msg);
                        }else if (result.code == web_status.WARNING) {
                            $.modal.alertWarning(result.msg)
                        } else {
                            $.modal.alertError(result.msg);
                        }
                        $.modal.closeLoading();
                        $.table.refresh();
                        //更新预警量
                        setRiskNum();
                    });
                }
            }else{
                ids = ids.join();
                var data = {ids:ids};
                $.operate.post(url,data,function (result) {
                    if (result.code == web_status.SUCCESS) {
                        $.modal.alertSuccess(result.msg);
                    }else if (result.code == web_status.WARNING) {
                        $.modal.alertWarning(result.msg)
                    } else {
                        $.modal.alertError(result.msg);
                    }
                    $.modal.closeLoading();
                    $.table.refresh();
                    //更新预警量
                    setRiskNum();
                });
            }
        }
        function exportItem(){
            var url = prefix+"/exportItem";
            var data = $('#formId').serialize();
            $.operate.post(url,data,function (result) {
                if (result.code == web_status.SUCCESS) {
                    window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
                }else if (result.code == web_status.WARNING) {
                    $.modal.alertWarning(result.msg)
                } else {
                    $.modal.alertError(result.msg);
                }
                $.modal.closeLoading();
            });
        }
        //查看流水明细信息
        function _viewTradeDetail(vchNo,trDate,brCode,trTelr){
            if(vchNo == "null" || vchNo == "" || trDate == "null" || trDate == null){
                return ;
            }
            //var url = ctx+"paea/paeaDsTrade?brCode="+brCode+"&trDate=" + trDate+"&vchNo=" +vchNo+"&trTelr="+trTelr;
            var url = prefix + '/paeaDsTrade?brCode='+brCode+'&trDate=' + trDate+'&vchNo=' +vchNo+'&trTelr='+trTelr;
            var returnValue = window.showModalDialog(url,"查看流水详细信息","dialogWidth=1024px; dialogHeight=750px; help=no;top=0; status=no; scroll=yes; resizable=no;");
        }
        function viewErrDetail(id){
            var url =  ctx  + 'er/paeaErErrorProcess/doProcessErrorPre?id='+id;
            //$.modal.openTab("督办处理详情", url);
            $.modal.openFullNoTitle("督办处理详情", url,document.body.clientWidth,document.body.clientHeight);
        }
        //修改的modal.open
        function modal_open(title, url, width, height, callback,endCallback) {
            //如果是移动端，就使用自适应大小弹窗
            if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) {
                width = 'auto';
                height = 'auto';
            }
            if ($.common.isEmpty(title)) {
                title = false;
            }
            if ($.common.isEmpty(url)) {
                url = "/404.html";
            }
            if ($.common.isEmpty(width)) {
                width = 900;
            }
            if ($.common.isEmpty(height)) {
                height = ($(window).height() - 50);
            }
            if ($.common.isEmpty(callback)) {
                callback = function(index, layero) {
                    operateType = "submit";
                    var iframeWin = layero.find('iframe')[0];
                    iframeWin.contentWindow.submitHandler(index, layero);
                }
            }
            layer.open({
                type: 2,
                area: [width + 'px', height + 'px'],
                fix: false,
                //不固定
                maxmin: true,
                shade: 0.3,
                title: title,
                content: url,
                btn: ['确定', '关闭'],
                // 弹层外区域关闭
                shadeClose: true,
                yes: callback,
                end:endCallback,
                cancel: function(index) {
                    return true;
                }
            });
        }


    </script>
    <!--监督小助手脚本-->
     <script th:inline="javascript">

         function commonSearch(title,src){
            var returnValue = window.showModalDialog(src,title,"dialogWidth=950px; dialogHeight=550px; help=no; status=no; scroll=yes; resizable=no;");
         }
         function writeLog(){
             $.operate.post(ctx + "wt/auditDaylogQuery/doCheckDayLogExists","",function (result) {
                 if (result.code == web_status.SUCCESS) {
                         var rt = result.msg;
                         var openUrl = "";
                         if(rt == "false"){
                             openUrl = ctx + "wt/auditDaylogCreate/add";
                         }
                         else{
                             openUrl =  ctx + "wt/auditDaylogCreate/modify/{id}";
                             openUrl = openUrl.replace("{id}",rt);
                         }
                     commonSearch('监控日志',openUrl);
                     //$.modal.openFull("监控日志",openUrl,850,650);
                     //var returnValue = window.showModalDialog(openUrl,"","dialogWidth=950px; dialogHeight=550px; help=no; status=no; scroll=yes; resizable=no;");

                 } else if (result.code == web_status.WARNING) {
                     $.modal.alertWarning(result.msg)
                 } else {
                     $.modal.alertError(result.msg);
                 }
                 $.modal.closeLoading();
             });
         }
         function _querySignature(){
             /*var orgCode = document.all.brCode?document.all.brCode.value:"";
             if(orgCode==""){
                 alert("预警列表中没有数据");
                 return;
             }*/
             //var url = ctx+"paea/signature/querySingature?orgCode="+orgCode;
             var url = ctx+"paea/signature";
             commonSearch('有权人签字',url);
         }
     </script>
</body>
</html>